package train48days;

import java.util.Scanner;

public class 数据库连接池 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
          while (sc.hasNext()){
              int n = sc.nextInt();
              sc.nextLine();
              int size = 0;
              int max=0;
              for (int i = 0; i < n; i++) {
                  String s = sc.nextLine();
                  if (!s.contains("disconnect")){
                      size++;
                      max = Math.max(size,max);
                  }else if (s.contains("disconnect")){
                      size--;
                  }
              }
              System.out.println(max);
          }
    }
}
